from django.db import models


# Create your models here.
class Ashop(models.Model):
    name = models.CharField(max_length=50)
    price = models.DecimalField(max_digits=5, decimal_places=2)
    pic = models.ImageField()

    class Meta:
        db_table = "Ashop"


class Bshop(models.Model):
    name = models.CharField(max_length=50)
    price = models.DecimalField(max_digits=5, decimal_places=2)
    pic = models.ImageField()

    class Meta:
        db_table = "Bshop"


class Users(models.Model):
    username = models.CharField(max_length=100)
    password = models.CharField(max_length=200)

    class Meta:
        db_table = "Users"


class Tea(models.Model):
    username = models.CharField(max_length=100)
    password = models.CharField(max_length=200)

    class Meta:
        db_table = "tea"


class Stu(models.Model):
    name = models.CharField(max_length=30)
    age = models.IntegerField()
    teacher = models.ForeignKey(Tea, models.CASCADE)

    class Meta:
        db_table = "stu"


# 年级
class Grade(models.Model):
    name = models.CharField(max_length=30)

    class Meta:
        db_table = "grade"


# 课程
class lesson(models.Model):
    name = models.CharField(max_length=20)
    grades = models.ForeignKey(Grade,models.CASCADE,related_name="gra")

    class Meta:
        db_table = "lesson"

class Friend(models.Model):
    name = models.CharField(max_length=50)
    username = models.CharField(max_length=100)
    password = models.CharField(max_length=200)
    niaji = models.ForeignKey(Grade,models.CASCADE)
    class Meta:
        db_table = "firend"








